using System;
using System.Collections.Generic;
using System.Text;
using Entities;
using DAL;

namespace BUS
{
   public  class tbMadealBUS
    {
        public static void Insert(tbMadeal madeal)
        {
            tbMadealDAL madealDAL = new tbMadealDAL();
            madealDAL.Insert(madeal);

        }
        public static void Uptate(tbMadeal madeal)
        {
            tbMadealDAL madealDAL = new tbMadealDAL();
            madealDAL.Update(madeal);

        }
        public static void Delete(int iD)
        {
            tbMadealDAL madealDAL = new tbMadealDAL();
            madealDAL.Delete(iD);
        }
        public static tbMadealCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbMadealDAL madealDAL = new tbMadealDAL();
            return madealDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbMadealCollection GetAll()
        {
            int total = 0;
            tbMadealDAL madealDAL = new tbMadealDAL();
            return madealDAL.Get("where 1=1", 0, 0,
            tbMadealColumns.Madeal .ToString(),
            "ASC", out total);
        }
        public static tbMadeal GetByID(int iD)
        {
            int total = 0;
            tbMadealDAL madealDAL = new tbMadealDAL();
            tbMadealCollection madealCollection = madealDAL.Get("where " +
            tbMadealColumns.Madeal .ToString() + "=" + iD.ToString(),
            0, 0, tbMadealColumns.Madeal .ToString(), "ASC", out total);
            if (madealCollection.Count > 0)
                return madealCollection[0];
            return null;
        }

    }
}
